package com.diandian.backend.store.param;

import com.diandian.backend.store.dto.StoreMeituanShangouStorePageParamDTO;
import com.diandian.base.boot.starter.exception.DefaultException;

import java.io.Serializable;

public class MeituanShangouStorePageParam implements Serializable {

	private Integer pageNum;
	private Integer pageSize;
	private String belongEql;
	private String storeNameLike;
	private String storeCodeLike;
	private String nodeCodeEql; // 顶级节点传0，未分组传-1
	private String orgIdEql;
	private String orgCodeEql;

	public void check(){
		if(this.pageNum == null || this.pageNum < 1 || this.pageSize == null || this.pageSize < 1){
			throw new DefaultException("分页参数不合法");
		}
		if(this.belongEql == null || "".equals(this.belongEql)){
			throw new DefaultException("归属标识不能为空");
		}
		if(this.nodeCodeEql == null || "".equals(this.nodeCodeEql)){
			throw new DefaultException("节点编码不能为空");
		}
	}

	public StoreMeituanShangouStorePageParamDTO toDTO(){
		StoreMeituanShangouStorePageParamDTO result = new StoreMeituanShangouStorePageParamDTO();
		result.setPageNum(this.pageNum);
		result.setPageSize(this.pageSize);
		result.setBelongEql(this.belongEql);
		result.setStoreNameLike(this.storeNameLike);
		result.setStoreCodeLike(this.storeCodeLike);
		result.setNodeCodeEql(this.nodeCodeEql);
		result.setOrgIdEql(this.orgIdEql);
		result.setOrgCodeEql(this.orgCodeEql);
		return result;
	}

	public Integer getPageNum() {
		return pageNum;
	}

	public void setPageNum(Integer pageNum) {
		this.pageNum = pageNum;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public String getBelongEql() {
		return belongEql;
	}

	public void setBelongEql(String belongEql) {
		this.belongEql = belongEql;
	}

	public String getNodeCodeEql() {
		return nodeCodeEql;
	}

	public void setNodeCodeEql(String nodeCodeEql) {
		this.nodeCodeEql = nodeCodeEql;
	}

	public String getOrgIdEql() {
		return orgIdEql;
	}

	public void setOrgIdEql(String orgIdEql) {
		this.orgIdEql = orgIdEql;
	}

	public String getOrgCodeEql() {
		return orgCodeEql;
	}

	public void setOrgCodeEql(String orgCodeEql) {
		this.orgCodeEql = orgCodeEql;
	}

	public String getStoreNameLike() {
		return storeNameLike;
	}

	public void setStoreNameLike(String storeNameLike) {
		this.storeNameLike = storeNameLike;
	}

	public String getStoreCodeLike() {
		return storeCodeLike;
	}

	public void setStoreCodeLike(String storeCodeLike) {
		this.storeCodeLike = storeCodeLike;
	}
}
